try { var dummy = TestComponent; } catch ( e ) {

function TestComponent(){
	// Do nothing. Use the init method instead.
	// The this.rtcf, property will be set after this constructor is called
	// but before the init method is called. You may need the this.rtcf
	// object. So, use init() to initialize your components.
}

// Required for AS 1 inheritance.
TestComponent.prototype = new RTCFComponent();

/**
 * This is where you:
 *   1. setup component resources like streams and shared objects
 *   2. ask to listen to application events
 *   3. make any remote calls to set up this component and 
 *      if necessary ask the framework to hold back accepting
 *      clients until the component is ready.
 *   4. grant permission for clients to call remote methods on this
 *      component. 
 */
TestComponent.prototype.init = function(){
	// init component properties and its resources here...
	
    // Allow this method to be called from clients in certain roles:
    this.allowRemoteCall("testRemoteMethod", "Guest", "User", "Administrator");

    // Allow any client, regardless of roles, to access this method:
    this.allowRemoteCall("testRemoteMethod2");
    
	// Let's try out listening for some events
	this.rtcf.addListener("onAppStart", this);
	this.rtcf.addListener("onAppStop", this);
	this.rtcf.addListener("onConnect", this);
	this.rtcf.addListener("onDisconnect", this);
	
	// Tell the framework we need to wait for this component to get ready:
	this.rtcf.addPendingComponent(this);
	
	// Let's wait five seconds to test the framework keeps clients pending until we're ready:
	this.intervalID = setInterval(this.allDone, 5000, this);
}

/** 
 * This method is called after five seconds and tells the framework 
 * the component is now ready. Since its a setInterval call back
 * I have to pass a reference to the component in. 
 */
TestComponent.prototype.allDone = function(testComponent){
	trace("TestComponent.allDone> ");
	testComponent.rtcf.removePendingComponent(testComponent);
	clearInterval(testComponent.intervalID);
}

TestComponent.prototype.onAppStart = function(){
	trace("TestComponent.onAppStart> ");
}

TestComponent.prototype.onAppStop = function(){
	trace("TestComponent.onAppStop> ");
}

/** Don't take this seriously. It's just for testing. */
TestComponent.prototype.onConnect = function(client){
	trace("TestComponent.onConnect> client: " + client);
	
	for (var i = 0; i < arguments.length; i++){
		trace("   arguments[" + i + "]: " + arguments[i] + " type: " + typeof arguments[i]);
	}
	
	/*
	application.acceptConnection(client);
	
	// Call the initTestComponent method on our client-side couterpart:
	this.callClientComponent(client, 'initTestComponent', null, 'hi', 'bye')
	*/
	return true;
}

TestComponent.prototype.onDisconnect = function(){
	trace("TestComponent.onDisconnect> ");
}

TestComponent.prototype.testRemoteMethod = function(){
	trace("TestComponent.testRemoteMethod> ");
	for (var i = 0; i < arguments.length; i++){
		trace("   arguments[" + i + "]: " + arguments[i] + " type: " + typeof arguments[i]);
	}
}

TestComponent.prototype.testRemoteMethod2 = function(){
	trace("TestComponent.testRemoteMethod2> ");
	for (var i = 0; i < arguments.length; i++){
		trace("   arguments[" + i + "]: " + arguments[i] + " type: " + typeof arguments[i]);
	}
	return "return value";
}

} // end catch
